package cl.orangepeople.whyem.portal.negotiations.beans.historic;

import java.io.Serializable;
import java.util.List;

import javax.annotation.Resource;
import javax.inject.Named;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;

import cl.orangepeople.whyem.portal.backend.api.NegotiationsService;
import cl.orangepeople.whyem.portal.backend.dto.negotiations.NegotiationDataBean;
import cl.orangepeople.whyem.portal.negotiations.utils.whyemUtils;

@Named("historicBean")
@Scope("session")
public class HistoricListBean implements Serializable {
    private static Logger logger = LoggerFactory.getLogger(HistoricListBean.class);
    private List<NegotiationDataBean> historicList;
    @Resource(name = "negotiationService")
    private NegotiationsService negotiationsService;

    public void initHistoricBean() {
	logger.debug("Loading historic lists");
        this.historicList = loadNegotiations();
    }

    public List<NegotiationDataBean> loadNegotiations() {
        return negotiationsService.getNegotiationsByClientID(whyemUtils.getUserClientID());
    }

    public List<NegotiationDataBean> getHistoricList() {
        return historicList;
    }

    public void setHistoricList(List<NegotiationDataBean> historicList) {
        this.historicList = historicList;
    }

    public NegotiationsService getNegotiationsService() {
        return negotiationsService;
    }

    public void setNegotiationsService(NegotiationsService negotiationsService) {
        this.negotiationsService = negotiationsService;
    }
}